package com.fsharemobile;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class FileModifierActivity extends Activity implements OnClickListener {

	Button btnOk,btnCancel;
	EditText edtNewFolder;
	TextView txtLabel;
	Bundle dataFromExplorer;
	int addOrMod;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		// hide titlebar of application
	    // must be before setting the layout
		
	    requestWindowFeature(Window.FEATURE_NO_TITLE);
	  
	    //close activity when touch
	    this.setFinishOnTouchOutside(false);
	    
	    //set layout for this activity
		setContentView(R.layout.activity_file_modifier);
		
		//load data from parent activity
		dataFromExplorer = getIntent().getExtras();
		if(dataFromExplorer!=null){
			addOrMod = dataFromExplorer.getInt("add");
		}
		
		txtLabel= (TextView) findViewById(R.id.txt_lable);
		edtNewFolder = (EditText) findViewById(R.id.edt_new_folder);
		btnOk= (Button) findViewById(R.id.btn_ok);
		btnCancel =(Button) findViewById(R.id.btn_cancel);
		btnOk.setOnClickListener(this);
		btnCancel.setOnClickListener(this);
		
		if(addOrMod==0){
			txtLabel.setText("Add new folder");
		}else if(addOrMod==1){
			txtLabel.setText("Change your folder name");
		}else{
			txtLabel.setText("");
		}
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.file_modifier, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v.getId()==R.id.btn_ok){
			
		}else if(v.getId()==R.id.btn_cancel){
			finish();
		}
	}

}
